<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title></title>
    <script src='./vue.global.js'></script>
</head>
<body>
    <div id='app'>
        <base-input ref="bi"></base-input>
    </div>

    

    <script>
        const app = Vue.createApp({
            data(){
                return {}
            },
            methods:{},
            computed:{},

            /* 加载完毕时勒令子组件聚焦 */
            mounted(){
                console.log("父组件加载完毕");

                // 一把抓住子组件并勒令其聚焦那该死的input框
                this.$refs.bi.focusTheFuckingInput()
            }
        })

        app.component("base-input",{
            template:`
            <input type="text" ref="ip">
            `,

            /* 组件挂载完毕时逮住ip对应的input框 勒令其聚焦  */
            mounted(){
                console.log("子组件加载完毕");
                // this.$refs.ip.focus()
            },

            methods:{
                focusTheFuckingInput(){
                    this.$refs.ip.focus()
                }
            }
        })
        app.mount('#app')
    </script>
</body>
</html>